<html>
<head><meta charset="utf-8"><title>proc macro support · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proc.20macro.20support.html">proc macro support</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203151227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proc%20macro%20support/near/203151227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proc.20macro.20support.html#203151227">(Jul 07 2020 at 19:48)</a>:</h4>
<p>Is there an issue that tracks support for procedural macros in rust-analyzer? I did not find one after a search on GitHub. I recently implemented a proc macro for JSX-like syntax: <code>let html = html!(&lt;div&gt;{text}&lt;/div&gt;);</code>. If rust-analyzer executed the procedural macro like rustc does, it could theoretically support features like "go to definition" and "find references" when the cursor is over the identifier <code>text</code>.</p>



<a name="203199828"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proc%20macro%20support/near/203199828" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proc.20macro.20support.html#203199828">(Jul 07 2020 at 20:38)</a>:</h4>
<p>You need to enable <code>rust-analyzer.loadOutDir</code> and <code>rust-analyzer.proc_macro</code> in the preferences. (not sure about the exact naming, but autocomplete should show them when editing the json preferences in vscode.</p>



<a name="203199873"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proc%20macro%20support/near/203199873" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proc.20macro.20support.html#203199873">(Jul 07 2020 at 20:39)</a>:</h4>
<p><span class="user-mention" data-user-id="294489">@nitsky</span> ^</p>



<a name="203199939"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proc%20macro%20support/near/203199939" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proc.20macro.20support.html#203199939">(Jul 07 2020 at 20:39)</a>:</h4>
<p>we don't support function-style proc macros yet though, only derives</p>



<a name="203199952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proc%20macro%20support/near/203199952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proc.20macro.20support.html#203199952">(Jul 07 2020 at 20:40)</a>:</h4>
<p>... do we? <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="203200447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proc%20macro%20support/near/203200447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proc.20macro.20support.html#203200447">(Jul 07 2020 at 20:44)</a>:</h4>
<p>Yup, we don't support fun-style proc macros yet</p>



<a name="203277447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/proc%20macro%20support/near/203277447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nitsky <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/proc.20macro.20support.html#203277447">(Jul 08 2020 at 14:56)</a>:</h4>
<p>thanks, I opened an issue: <a href="https://github.com/rust-analyzer/rust-analyzer/issues/5265">https://github.com/rust-analyzer/rust-analyzer/issues/5265</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>